package http;

import java.net.URL;
import java.util.Map;
import java.util.TreeMap;
import net.htmlparser.jericho.Source;

public class CaptchaPageParserStrategy extends Parser implements IParserStrategy {
	private Map<String,Link> links = new TreeMap<String,Link>();
	private Link captcha;
	private CaptchaForm captchaForm;
	public CaptchaForm getCaptchaForm() {
		return captchaForm;
	}
	public Map<String, Link> getLinks() {
		return links;
	}
	private boolean parseable = false;
	@Override
	public boolean isParseable() {
		return parseable;
	}
	@Override
	public void parse(URL url,Source source) {
		if (validate(url,source,"captcha")) {
			parseable = true;
			captcha = getCaptchaImageLink(source,"captcha");
			captchaForm = getCaptchaForm(source, "captcha");
		}
	}
	public Link getCaptcha() {
		return captcha;
	}
}
